package Atop100.huisu;

import java.util.ArrayList;
import java.util.List;

public class Class78 {


    List<List<Integer>>  ans;
    List<Integer> path;
    public List<List<Integer>> subsets(int[] nums) {
        ans=new ArrayList<>();
        path=new ArrayList<>();
        backtracking(nums,0);
        return  ans;
    }
    public void  backtracking(int[] nums,int startIndex){
        if (startIndex>nums.length){
            return;
        }
        ans.add(new ArrayList<>(path));

        for (int i = startIndex; i < nums.length ; i++) {
            path.add(nums[i]);
            backtracking(nums,i+1);
            path.remove(path.size()-1);
        }
    }

}
